using System;
using System.Drawing;
using System.Windows.Forms;

public partial class Form1 : Form
{
    private Panel headerPanel;
    private Panel contentPanel;
    private Panel footerPanel;
    private DataGridView dataGridView;
    private Button addButton;
    private Button editButton;
    private Button deleteButton;
    private TextBox searchTextBox;
    private Label searchLabel;

    public Form1()
    {
        InitializeComponent();
        SetupFakeData();
    }

    private void InitializeComponent()
    {
        // 设置窗体基本属性
        this.Size = new Size(800, 600);
        this.Text = "数据管理系统";
        this.StartPosition = FormStartPosition.CenterScreen;

        // 创建头部面板
        headerPanel = new Panel();
        headerPanel.Size = new Size(800, 60);
        headerPanel.BackColor = Color.FromArgb(64, 64, 64);
        headerPanel.Dock = DockStyle.Top;

        // 创建内容面板
        contentPanel = new Panel();
        contentPanel.Size = new Size(800, 440);
        contentPanel.Dock = DockStyle.Fill;
        contentPanel.Padding = new Padding(10);

        // 创建底部面板
        footerPanel = new Panel();
        footerPanel.Size = new Size(800, 60);
        footerPanel.BackColor = Color.FromArgb(224, 224, 224);
        footerPanel.Dock = DockStyle.Bottom;

        // 创建搜索控件
        searchLabel = new Label();
        searchLabel.Text = "搜索:";
        searchLabel.Location = new Point(10, 20);
        searchLabel.Size = new Size(40, 20);
        searchLabel.ForeColor = Color.White;

        searchTextBox = new TextBox();
        searchTextBox.Location = new Point(60, 18);
        searchTextBox.Size = new Size(200, 25);

        // 创建按钮
        addButton = new Button();
        addButton.Text = "添加";
        addButton.Size = new Size(75, 30);
        addButton.Location = new Point(10, 15);

        editButton = new Button();
        editButton.Text = "编辑";
        editButton.Size = new Size(75, 30);
        editButton.Location = new Point(100, 15);

        deleteButton = new Button();
        deleteButton.Text = "删除";
        deleteButton.Size = new Size(75, 30);
        deleteButton.Location = new Point(190, 15);

        // 创建数据表格
        dataGridView = new DataGridView();
        dataGridView.Size = new Size(760, 380);
        dataGridView.Location = new Point(10, 10);
        dataGridView.AutoGenerateColumns = false;
        dataGridView.AllowUserToAddRows = false;
        dataGridView.ReadOnly = true;
        dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
        dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;

        // 添加列到数据表格
        dataGridView.Columns.Add("ID", "编号");
        dataGridView.Columns.Add("Name", "名称");
        dataGridView.Columns.Add("Description", "描述");
        dataGridView.Columns.Add("Status", "状态");
        dataGridView.Columns.Add("Date", "日期");

        // 将控件添加到相应面板
        headerPanel.Controls.Add(searchLabel);
        headerPanel.Controls.Add(searchTextBox);

        contentPanel.Controls.Add(dataGridView);

        footerPanel.Controls.Add(addButton);
        footerPanel.Controls.Add(editButton);
        footerPanel.Controls.Add(deleteButton);

        // 将面板添加到窗体
        this.Controls.Add(contentPanel);
        this.Controls.Add(footerPanel);
        this.Controls.Add(headerPanel);
    }

    private void SetupFakeData()
    {
        // 添加假数据
        dataGridView.Rows.Add("001", "项目A", "这是项目A的描述", "进行中", "2023-05-15");
        dataGridView.Rows.Add("002", "项目B", "这是项目B的描述", "已完成", "2023-06-20");
        dataGridView.Rows.Add("003", "项目C", "这是项目C的描述", "待开始", "2023-07-10");
        dataGridView.Rows.Add("004", "项目D", "这是项目D的描述", "进行中", "2023-08-05");
        dataGridView.Rows.Add("005", "项目E", "这是项目E的描述", "已暂停", "2023-09-12");
        dataGridView.Rows.Add("006", "项目F", "这是项目F的描述", "进行中", "2023-10-18");
        dataGridView.Rows.Add("007", "项目G", "这是项目G的描述", "已完成", "2023-11-22");
    }
}